﻿Public Class MainForm

	Dim Views As New Stack(Of View)

	Sub New()
		InitializeComponent()
      ListBox1.IconSize = New Size(96, 96)
		Studio.Open()
		Dim ViewTop As New ViewTop
		Views.Push(ViewTop)
		ViewTop.List = ListBox1
		ViewTop.Run()
	End Sub

	Private Sub ListBox1_DrawItem(ByVal sender As Object, ByVal e As ListBox.ListBoxDrawItemEventArgs) Handles ListBox1.DrawItem
		Views.Peek.Draw(e)
	End Sub

	Private Sub ListBox1_Tapped(ByVal Key As String) Handles ListBox1.Tapped
		Select Case Key
			Case "Back"
				Views.Pop()
				Views.Peek.Run()
			Case Else
				Views.Peek.Tapped(Key)
		End Select
	End Sub

	Sub Redraw(ByVal File As String)
		ListBox1.Redraw(File)
	End Sub

	Sub ShowPhoto()
		Dim ViewPhoto As New ViewPhoto
		Views.Push(ViewPhoto)
		ViewPhoto.List = ListBox1
		ViewPhoto.Run()
	End Sub

	Sub ShowAlbum(ByVal Key As String)
		Dim ViewAlbum As New ViewAlbum
		Views.Push(ViewAlbum)
		ViewAlbum.List = ListBox1
		ViewAlbum.Key = Key
		ViewAlbum.Run()
	End Sub

	Sub GoBack()
		Views.Pop()
		Views.Peek.Run()
	End Sub

End Class